<template>
  <div>
    <header class="my-header">
      <comp-header>
        <template v-slot:ctitle>我的</template>
        <template v-slot:cicon>
          <span class="fa fa-gear"></span>
        </template>
      </comp-header>
      <div class="my-info">
        <div class="left">
          <div class="touxiang"><img src="../assets/local1.jpg" alt="" /></div>
          <div class="info">
            <h4 v-if="!islogin">
              <a href="#/login">登录 </a>|
              <a href="#/register">注册</a>
            </h4>
            <h4 v-if="islogin">小明</h4>
            <p v-if="islogin">182****9558</p>
          </div>
        </div>
        <div class="right">
          <button>实名认证<span class="fa fa-caret-right"></span></button>
        </div>
      </div>
      <div class="my-money">
        <ul>
          <li>
            <div class="num">
              <span class="micon">￥</span><span>0.00</span>
            </div>
            <div class="text"><span>余额</span></div>
          </li>
          <li>
            <div class="num"><span>0</span></div>
            <div class="text"><span>银行卡</span></div>
          </li>
          <li>
            <div class="num"><span>0</span></div>
            <div class="text"><span>优惠券</span></div>
          </li>
        </ul>
      </div>
    </header>
    <div class="my-list">
      <ul>
        <li>
          <a href="javascript:;">
            <span class="icon"></span>
            <span class="text">我的订单</span>
          </a>
        </li>
        <li>
          <a href="javascript:;">
            <span class="icon"></span>
            <span class="text">红包</span>
          </a>
        </li>
        <li>
          <a href="javascript:;">
            <span class="icon"></span>
            <span class="text">借钱</span>
          </a>
        </li>
        <li>
          <a href="javascript:;">
            <span class="icon"></span>
            <span class="text">意见反馈</span>
          </a>
        </li>
        <li>
          <a href="javascript:;">
            <span class="icon"></span>
            <span class="text">保险</span>
          </a>
        </li>
        <li>
          <a href="javascript:;">
            <span class="icon"></span>
            <span class="text">我的地址</span>
          </a>
        </li>
        <li>
          <a href="javascript:;">
            <span class="icon"></span>
            <span class="text">邀请有礼</span>
          </a>
        </li>
        <li>
          <a href="javascript:;">
            <span class="icon"></span>
            <span class="text">客服中心</span>
          </a>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import compHeader from "@/components/comp-header.vue";
export default {
  name: "My",
  components: {
    compHeader: compHeader,
  },
  data() {
    return {
      loginobj: {},
      islogin: true,
    };
  },
  // watch: {
  //   loginobj(v) {
  //     if (v.name) {
  //       console.log(this.islogin);
  //       this.islogin = true;
  //     } 
  //     else if(v.name == '') {
  //       console.log(this.islogin);
  //       this.islogin = false;
  //     }
  //   },
  // },
  // mounted() {
  //   this.loginobj = this.$route.query.loginobj;
  //   console.log(this.loginobj);
  // },
};
</script>

<style lang="scss" scoped>
.my-header {
  width: 100%;
  height: 292px;
  background-color: #111030;
  color: #fff;
  .my-info {
    width: 100%;
    height: 80px;
    display: flex;
    padding: 0 20px;
    justify-content: space-between;
    box-sizing: border-box;
    align-items: center;
    .left {
      display: flex;
      align-items: center;
      .touxiang {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        overflow: hidden;
        box-shadow: 0 0 5px #ccc;
        img {
          width: 100%;
        }
      }
      .info {
        margin-left: 15px;
        h4 {
          font-size: 17px;
          a {
            color: #fff;
          }
        }
        p {
          margin-top: 10px;
          font-size: 14px;
        }
      }
    }
    .right {
      button {
        width: 70px;
        height: 25px;
        border-radius: 12px;
        font-size: 12px;
        color: #fffefe;
        background-color: rgba(246, 246, 246, 0.3);
        span {
          margin-left: 5px;
        }
      }
    }
  }
  .my-money {
    width: 100%;
    height: 75px;
    padding: 0 20px;
    box-sizing: border-box;
    ul {
      width: 100%;
      height: 75px;
      display: flex;
      justify-content: space-between;
      text-align: center;
      border-top: 1px solid rgba(246, 246, 246, 0.3);
      li {
        height: 75px;
        .num {
          margin-top: 15px;
          font-size: 18px;
        }
        .text {
          margin-top: 5px;
          font-size: 13px;
        }
      }
    }
  }
}
.my-list {
  width: 356px;
  height: 304px;
  box-shadow: 0 0 5px #ccc;
  background-color: #fff;
  margin: 0 auto;
  position: relative;
  top: -70px;
  font-size: 14px;
  border-radius: 5px;
  ul {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    li {
      margin-top: 35px;
      flex-basis: 33.3333%;
      flex-flow: 1;
      flex-shrink: 0;
      text-align: center;
      a {
        .icon {
          display: block;
          margin-left: 45px;
          width: 60px * (5/10);
          height: 60px * (5/10);
          background: url(../assets/sprite2.png) no-repeat;
          background-size: (623px * (5/10)) (1016px * (5/10));
        }
        .text {
          display: block;
          margin-top: 10px;
          font-size: 12px;
        }
      }
    }
    li:nth-child(1) .icon {
      background-position: (-345px * (5/10)) (-460px * (5/10));
    }
    li:nth-child(2) .icon {
      background-position: (-485px * (5/10)) (-460px * (5/10));
    }
    li:nth-child(3) .icon {
      background-position: (-80px * (5/10)) (-600px * (5/10));
    }
    li:nth-child(4) .icon {
      background-position: (-215px * (5/10)) (-600px * (5/10));
    }
    li:nth-child(5) .icon {
      background-position: (-350px * (5/10)) (-600px * (5/10));
    }
    li:nth-child(6) .icon {
      background-position: (-485px * (5/10)) (-600px * (5/10));
    }
    li:nth-child(7) .icon {
      background-position: (-80px * (5/10)) (-735px * (5/10));
    }
    li:nth-child(8) .icon {
      background-position: (-215px * (5/10)) (-735px * (5/10));
    }
  }
}
</style>